﻿using System;
using System.Collections.Generic;
using System.Text;
using IService.Data.IManager;
using System.Data;
using IService.DataDLL;
using IService.Model;

namespace IService.Data.OlbImpl.ManagerImpl
{
    public class ActivityDaManager : IActivityDaManager
    {
        public DataTable GetActivityListAll(Type infoType)
        {
            return DataAccess.SelectAll(infoType);
        }

        public DataTable GetActivityListPagin(Type infoType, PagingEntity pe)
        {
            return DataAccess.SelectPaging(infoType, pe);
        }

        public DataTable GetLatestActivityList(Type infoType, int Activitynum)
        {
            string WhereClause = "";
            string Order = "CreateTime desc";
            return DataAccess.SelectTop(infoType, Activitynum, WhereClause, Order);
        }

        public Activity GetActivityById(Activity activity)
        {
            activity.Select();
            return activity;
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="Activity"></param>
        /// <returns></returns>
        public bool InsertActivity(Activity activity)
        {
            return DataAccess.Insert(activity);
        }

        public bool UpdateActivity(Activity activity)
        {
            return DataAccess.Update(activity);
        }

        public bool DeleteActivity(Activity activity)
        {
            return DataAccess.Delete(activity);
        }

        public bool DeleteActivityByIds(Type infoType, string Ids)
        {
            string WhereClause = "Id in(" + Ids + ")";
            return DataAccess.Delete(infoType, WhereClause);
        }
    }
}
